package com.foreverwin.mes.so.service;

import com.baomidou.mybatisplus.plugins.Page;
import com.foreverwin.mes.meapi.model.Resrce;
import com.foreverwin.mes.so.dto.ShopOrderDispatchVO;
import com.foreverwin.mes.so.model.ShopOrderDispatch;
import com.baomidou.mybatisplus.service.IService;
import com.foreverwin.mes.core.base.FrontPage;
import com.foreverwin.mes.so.model.ShopOrderDispatchDetail;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 工单派工主表 服务类
 * </p>
 *
 * @author Syngna
 * @since 2020-02-06
 */
public interface ShopOrderDispatchService extends IService<ShopOrderDispatch> {

    /**
     * 分页查询
     *
     * @param frontPage
     * @return
     */
    Page<ShopOrderDispatch> selectPage(FrontPage<ShopOrderDispatch> frontPage, ShopOrderDispatch shopOrderDispatch);

    List<ShopOrderDispatch> selectList(ShopOrderDispatch shopOrderDispatch);

    Page<ShopOrderDispatch> selectDispatchShopOrderPage(Page page, ShopOrderDispatch shopOrderDispatch);

    ShopOrderDispatch getDispatchShopOrder(ShopOrderDispatch shopOrderDispatch);

    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    Resrce getResourceDispatchInfo(String site, String resrce, String itemBo);

    void isResourceFree(String site, ShopOrderDispatch shopOrderDispatch);

    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    ShopOrderDispatch splitSimple(String site, ShopOrderDispatch shopOrderDispatch);

    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    ShopOrderDispatch splitByShift(String site, ShopOrderDispatch shopOrderDispatch);

    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    ShopOrderDispatch splitByResourceBatch(String site, ShopOrderDispatch shopOrderDispatch);

    void saveBatch(String site, String user, ShopOrderDispatchVO shopOrderDispatchVO);

    List<ShopOrderDispatch> listByShopOrder(String site, String shopOrder);

    List<Resrce> listResourceByShopOrder(String site, String shopOrder);
}